package claim.fuzzy;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/** A linear membership function.
 * @author kinkeldey
 *
 */
public class MinusXPlus1ExponentMembershipFunction implements MembershipFunction {

	private static final Log LOG = LogFactory
			.getLog(MinusXPlus1ExponentMembershipFunction.class);
	
	private double pow;

	public MinusXPlus1ExponentMembershipFunction(double pow) {
		this.pow = pow;
	}

	@Override
	public float getValue(float t) {
		if (t < 0 || t > 1) {
			throw new IllegalArgumentException("coordinate must be in interval [0.0, 1.0].");
		} else {
			return (float) (Math.pow(-t+1, pow));
		}
	}
}
